/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.adama.service;

import fr.adama.repository.RebuiltIndex;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author avisto
 */
@Service
@Transactional()
public class RebuildIndexService {
    @Autowired
    RebuiltIndex rebuild;
    
    
    @PostConstruct
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void rebuild() throws InterruptedException{
        rebuild.rebuiltIndex();
    }
}
